﻿using DAL;
using MODEL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace BLL
{
   public class CarrierBLL
    {
        CarrierDAL carrierDAL = new CarrierDAL();

        #region 显示历史承运单信息
        /// <summary>
        /// 显示历史承运单信息
        /// </summary>
        /// <param name="carrier"></param>
        /// <returns></returns>
        public List<CarrierinfoMODEL> Get_carrierinfo(CarrierMODEL carrier)
        {
            return carrierDAL.Get_carrierinfo(carrier);
        }
        #endregion

        #region 承运单维护查询
        /// <summary>
        /// 承运单维护查询
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List<CarrierinfoMODEL> GetCarriesList(CarrierMODEL model)
        {
            return carrierDAL.GetCarriesList(model);
        }
        #endregion

        #region 承运单详情
        public DataTable GetXingQing(int carrid)
        {
            return carrierDAL.GetXingQing(carrid);
        }
        #endregion

        #region 成本维护
        /// <summary>
        /// 成本维护
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List<CarrierinfoMODEL> GetCarrerInfo(CarrierMODEL model)
        {
            return carrierDAL.GetCarrerInfo(model);
        }
        #endregion

        public CarrierMODEL GetSelet(int ID)
        {
            return carrierDAL.GetSelet(ID);
        }

        public CarrierMODEL GetCarriersID(int ID)
        {
            return carrierDAL.GetCarriersID(ID);
        }

        public List<CarrierinfoMODEL> GetCarriers(CarrierMODEL car)
        {
            return carrierDAL.GetCarriers(car);
        }

        /// <summary>
        /// 存储过程查询承运单
        /// </summary>
        /// <param name="carriersd"></param>
        /// <param name="ReceiveLinkman"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="TotalCount"></param>
        /// <returns></returns>
        public List<CarrierinfoMODEL> GetPagesCarriers(string CarriersID, string ReceiveLinkman, string SendLinkman, string startTime, string endTime, int PageIndex, int PageSize, out int TotalCount)
        {
            return carrierDAL.GetPagesCarriers(CarriersID, ReceiveLinkman, SendLinkman, startTime, endTime, PageIndex, PageSize,out TotalCount);
        }

        /// <summary>
        /// 修改承运单
        /// </summary>
        /// <param name="carm"></param>
        /// <returns></returns>
        public int UpCarriage(CarrierinfoMODEL carm)
        {
            return carrierDAL.UpCarriage(carm);
        }
        /// <summary>
        /// 接收承运单签收
        /// </summary>
        /// <param name="CarrierID"></param>
        /// <returns></returns>
        public int UpAccept(int CarrierID)
        {
            return carrierDAL.UpAccept(CarrierID);
        }
        //update Carriers set ReceiveDate=getdate(),FinishedState=2 where CarriersID=1
        public int ReceiveAccept(int CarrierID)
        {
            return carrierDAL.ReceiveAccept(CarrierID);
        }


        /// <summary>
        /// 修改逻辑判断
        /// </summary>
        /// <param name="CarrierID"></param>
        /// <returns></returns>
        public int UpAcceptAlert(int CarrierID)
        {
            return carrierDAL.UpAcceptAlert(CarrierID);
        }

        /// <summary>
        /// 删除承运单
        /// </summary>
        /// <param name="CarrierID"></param>
        /// <returns></returns>
        public int DelCarriage(int CarrierID)
        {
            return carrierDAL.DelCarriage(CarrierID);
        }
        /// <summary>
        /// 删除逻辑判断
        /// </summary>
        /// <param name="DriverID"></param>
        /// <returns></returns>
        public int DeleteCarriage(int CarrierID)
        {
            return carrierDAL.DeleteCarriage(CarrierID);
        }
        /// <summary>
        /// 插入承运单信息
        /// </summary>
        /// <param name="carm"></param>
        /// <returns></returns>
        public int InsertCarriage(CarrierinfoMODEL carm)
        {
            return carrierDAL.InsertCarriage(carm);
        }
    }
}
